Ext.define('BISC.model.FolderModel', {
  extend: 'Ext.data.Model',
  fields: [
    {
        name: 'text',
        mapping: 'path',
        convert: function( value, record ) {
            var sep = value.indexOf( '/' );
            if ( sep >= 0 ) {
                sep = '/';
            } else {
                sep = '\\';
            }
            if ( value.charAt(value.length-1) == sep ) value = value.slice( 0, -1 );
            return value.substr( value.lastIndexOf( sep ) + 1 );
        }
    },
    {
        name: 'subpath',
        mapping: 'path',
        convert: function( value, record ) {
            var sep = value.indexOf( '/' );
            if ( sep >= 0 ) {
                sep = '/';
            } else {
                sep = '\\';
            }
            if ( value.charAt(value.length-1) == sep ) value = value.slice( 0, -1 );
            return value.substr( 0, value.lastIndexOf( sep ) + 1 );
        }
    },
    {
        name: 'path'
    },
    {
        name: 'leaf'
    },
    {
        name: 'expanded'
    },
    {
        name: 'id'
    },
    {
        name: 'sz'
    }
  ]

});
